using System.Collections;
using UnityEngine;

public class DailyUI : MonoBehaviour
{
	public daily_item[] items;

	public UIScrollBar barbarbar;

	public int showitem;

	public void enable()
	{
		showitem = -1;
		MenuPlayerprefs.instance.readdailytask();
		for (int i = 0; i < items.Length; i++)
		{
			if (items[i].enable(i) && showitem == -1)
			{
				showitem = i;
			}
		}
		StartCoroutine(setbegin());
	}

	public bool hintenable()
	{
		bool result = false;
		showitem = -1;
		MenuPlayerprefs.instance.readdailytask();
		for (int i = 0; i < items.Length; i++)
		{
			if (items[i].enable(i) && showitem == -1)
			{
				showitem = i;
				result = true;
			}
		}
		return result;
	}

	private IEnumerator setbegin()
	{
		for (int i = 0; i < 2; i++)
		{
			yield return 0;
		}
		barbarbar.value = (float)(showitem - 2) / (float)(items.Length - 3);
	}
}
